﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Clandestine.Items
{
    public class Inventory
    {
        public Dictionary<string, Item> Items = new Dictionary<string, Item>();

        public void AddItem(Item i)
        {
            Log.i("Adding item {0} ({1}) to inventory.", i.Name, i.UUID);
            lock (Items)
                if (!Items.ContainsKey(i.UUID))
                {
                    i.Container = this;
                    Items.Add(i.UUID, i);
                }
                else
                    Log.e("Tried to add an item to the inventory but an item with that UUID already exists in it D:");
        }

        public void RemoveItem(string uuid)
        {
            Log.i("Removing item {0} from inventory.", uuid);
            lock (Items)
                if (Items.ContainsKey(uuid))
                    Items.Remove(uuid);
                else
                    Log.e("Tried to delete an item from the inventory but an item with that UUID does not exist!");
        }


    }
}
